fix: use the first available locale to decide directionality on Android#53417
fix: use the first available locale to decide directionality on Android#53417kainzhong wants to merge 1 commit intofacebook:mainfrom
Conversation
…roid Summary: on iOS, if the default locale is not supported in the app, it will fall back to the first available locale to decide if RTL layout should be enabled or not; however on Android, we use the default locale. So if the first locale is a RTL locale and not supported by the app on Android, the app will fall back to the first available locale which might not be RTL, but the layout would be decided as RTL according to the default locale.
|
Hi @PRESIDENT810! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
(I just signed CLA |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
This pull request was successfully merged by Kaining Zhong in a03780d When will my fix make it into a release? | How to file a pick request? |
|
this causes the issue, now changing the app language from englist to arabic still forces LTR instead of RTL. Locale.getAvailableLocales()[0] It should be using one of these instead: |
Summary:
On iOS, if the default locale is not supported in the app, it will fall back to the first available locale to decide if RTL layout should be enabled or not; however on Android, we use the default locale. So if the first locale is a RTL locale and not supported by the app on Android, the app will fall back to the first available locale which might not be RTL, but the layout would be decided as RTL according to the default locale.
Changelog:
[ANDROID] [FIXED] - use the first available locale instead of the default one to decide
isDevicePreferredLanguageRTLTest Plan:
I set my phone's locale to this order: Hebrew, English and enabled RTL layout:
Prior to my PR, the app would use RTL layout with English on Android which doesn't make much sense (iOS is LTR + English). With my PR Android app will behave exactly the same as the iOS app.